import 'package:json_annotation/json_annotation.dart';
import 'package:sjx/repository/model/task_detail_model.dart';

part 'task_edit_detail_model.g.dart';

@JsonSerializable()
class TaskEditDetailModel {
  final bool approveByOwner;
  final int taskDurationHours;
  final int originalBidTime;
  final double serviceFeePercent;
  final int bidSubmitDurationHours;
  final int ownerApproveDurationHours;
  final double sourceAmount;
  final List<String>? approveUserAvatars;
  final int bidTimesByUser;
  @JsonKey(name: 'deviceType', defaultValue: '')
  final String deviceType;
  final String taskCategory;
  final String taskDescription;
  final List<String> taskLinks;
  final String taskNo;
  final String taskRequirement;
  final List<String> taskRequirementImages;
  final List<String> taskStepImages;
  final List<TaskStep> taskStepList;
  final String taskSteps;
  final String taskTitle;
  final String taskType;

  // 添加可空字段和默认值
  final String? openView;
  final int? mockNumber;
  final bool? recommended;
  final String? unitType;
  final String? taskModel;
  final String? taskStepImagesValue;
  final String? taskRequirementImagesValue;

  TaskEditDetailModel({
    required this.approveByOwner,
    required this.taskDurationHours,
    required this.originalBidTime,
    required this.serviceFeePercent,
    required this.bidSubmitDurationHours,
    required this.ownerApproveDurationHours,
    required this.sourceAmount,
    required this.approveUserAvatars,
    required this.bidTimesByUser,
    required this.deviceType,
    required this.taskCategory,
    required this.taskDescription,
    required this.taskLinks,
    required this.taskNo,
    required this.taskRequirement,
    required this.taskRequirementImages,
    required this.taskStepImages,
    required this.taskStepList,
    required this.taskSteps,
    required this.taskTitle,
    required this.taskType,
    this.openView,
    this.mockNumber,
    this.recommended,
    this.unitType,
    this.taskModel,
    this.taskStepImagesValue,
    this.taskRequirementImagesValue,
  });

  factory TaskEditDetailModel.fromJson(Map<String, dynamic> json) =>
      _$TaskEditDetailModelFromJson(json);

  Map<String, dynamic> toJson() => _$TaskEditDetailModelToJson(this);
}